<template>

  <div style="border: 2px #1a43c5 solid;width: 400px;height: 200px;margin: 0 auto">
    <h1>这是子组件</h1>
    <span>MyFatherName is :{{fathername}}</span><br>
    <span>MyFatherAge is :{{age}}</span><br>
    <span>MyFatherSex is :{{sex}}</span><br>
    <input v-model="num">
    <button @click="sendToFather">展示</button>
  </div>
</template>

<script>
export default {
  name: "MySon",
  data() {
    return {
      num:null
    }
  },
  methods: {
    sendToFather(){
      this.$emit("receiveFromSon",this.num)
    }
  },
  props:{
    fathername:String,
    age:{
      type:Number,
      default:18

    },
    sex:Boolean
  }
}
</script>

<style scoped>

</style>